package at.jku.se.fastsell.db4o.transactions;

import com.db4o.ObjectSet;

import at.jku.se.fastsell.db4o.DatabaseException;

/**
 * Deletes all data in database
 */
public class ClearDatabaseTransaction extends Transaction<Void> {

	@Override
	public Void run() throws DatabaseException {

		@SuppressWarnings("rawtypes")
		ObjectSet objects = db.queryByExample(null);
		for (Object o : objects) {
			db.delete(o);
		}
		
		db.commit();
		
		return null;
	}	

}
